WebView Geri Butonu ?
19.01.2017 - 05:00
Arkadaşlar geri butonunu nasıl aktif edebilirim ? geri deyince direk uygulamadan çıkıyor ?
package net.video.mobilvideo;
import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.loadUrl("http://m.youtube.net");
final ProgressDialog progressDialog=ProgressDialog.show(this, "Mobil Video İzle", "Bağlantınız Kontrol Ediliyor", true);
progressDialog.show();
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Toast.makeText(MainActivity.this, "", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
Toast.makeText(MainActivity.this, "Bir hata oluştur!", Toast.LENGTH_SHORT);
progressDialog.dismiss();
}
});
}
}
268
Görüntülenme
0 Beğeni